window.onload=function (){
    setLoginInfo()
}
function setLoginInfo(){
    axios.get("user/getLoginUser").then(resp=>{
        var info= resp.data
        if(info == ''){
            $("login").innerHTML = "对不起，请先<a href='/login.html'>登陆</a>";
        }else {
            $("nameSpan").innerHTML="欢迎光临 "+info.name;
            $("faceImg").src="/emFace/"+info.imgPath;
            $("nickname").innerHTML=info.nickname
            $("EmaiSpam").innerHTML=info.email;
        }
    })
    axios.get("channel/findAll").then(resp=>{
        var info=resp.data
        var str=""
        info.forEach(n=>{
            str+=`<tr><td onclick="location.href='/post.html?id=${n.id}'">${n.name}</td><td>${n.describe}</td><td>${n.themeNum}</td></tr>`;
        })
        $("td").innerHTML= str
    })
}